package com.tom.commonframework.common.base.utils;

import com.orhanobut.logger.Logger;
import com.tom.commonframework.common.http.LocalInfoControlCenter;

/**
 * Created by TomLeisen on 2018/7/9 下午5:38
 * Email: xy162162a@163.com
 * Description:Logger 日志统一管理类
 */
public class LoggerUtils {

    private static boolean DEBUG = LocalInfoControlCenter.INSTANCES.isLog_debug();

    public static void d(String message, Object... args) {
        if (DEBUG){
            Logger.d(message, args);
        }
    }

    public static void d(Object object) {
        if (DEBUG){
            Logger.d(object);
        }
    }

    public static void e(String message, Object... args) {
        if (DEBUG){
            Logger.e(null, message, args);
        }
    }

    public static void e(Throwable throwable, String message, Object... args) {
        if (DEBUG){
           Logger.e(throwable, message, args);
        }
    }

    public static void i(String message, Object... args) {
        if (DEBUG){
            Logger.i(message, args);
        }
    }

    public static void v(String message, Object... args) {
        if (DEBUG){
            Logger.v(message, args);
        }
    }

    public static void w(String message, Object... args) {
        if (DEBUG){
            Logger.w(message, args);
        }
    }

    public static void wtf(String message, Object... args) {
        if (DEBUG){
            Logger.wtf(message, args);
        }
    }

    /**
     * Formats the json content and print it
     *
     * @param json the json content
     */
    public static void json(String json) {
        if (DEBUG){
            Logger.json(json);
        }
    }

    /**
     * Formats the json content and print it
     *
     * @param xml the xml content
     */
    public static void xml(String xml) {
        if (DEBUG){
            Logger.xml(xml);
        }
    }
}
